home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #include <stdio.h>
- #include <gl.h>
- #include <math.h>
- #include <device.h>
- #include <string.h>
- #include <unistd.h>
- #include "exbookglo.h"
- #include "shelves.h"
- #include "exglobals.h"
-
- void resetshelfcolors()
- {
- color_mult = 1.0;
- morecolors[shelfcolor][0] = 138;
- morecolors[shelfcolor][1] = 84;
- morecolors[shelfcolor][2] = 51;
- /* good purple color
- morecolors[shelfcolor][0] = 102;
- morecolors[shelfcolor][1] = 0;
- morecolors[shelfcolor][2] = 179;
- */
- /*
- morecolors[shelflight][0] = 133;
- morecolors[shelflight][1] = 63;
- morecolors[shelflight][2] = 225;
- morecolors[shelflight2][0] = 123;
- morecolors[shelflight2][1] = 63;
- morecolors[shelflight2][2] = 209;
- morecolors[shelfdark][0] = 55;
- morecolors[shelfdark][1] = 0;
- morecolors[shelfdark][2] = 102;
- */
- }
-
- void setshelfcolor(float carray[3])
- {
- carray[0] = (float) morecolors[shelfcolor][0] / 255.0 * color_mult;
- carray[1] = (float) morecolors[shelfcolor][1] / 255.0 * color_mult;
- carray[2] = (float) morecolors[shelfcolor][2] / 255.0 * color_mult;
- /*
- * printf(" color set to %f %f %f mult = %f\n", carray[0], carray[1],
- * carray[2], color_mult);
- */
- }
-
- void movebookonshelf(int booknum, float newpos)
- {
- bookpos[booknum] = newpos;
- }
-
- void initxflip(int num)
- {
- int ndx, prevndx;
- float tmp;
- float xtincr;
- int i;
-
- xt[0] = bookpos[num]; /* this is the position of the book on the
- * shelf */
- tmp = 7.0 / flipincr;
- ndx = (int) (tmp +.5);
- for (i = 1; i <= ndx; i++) {
- xt[i] = xt[0];
- }
- prevndx = ndx;
- ndx = ndx + (2.0 * ndx / 3.0);
- for (i = prevndx + 1; i <= ndx; i++) {
- xt[i] = xt[prevndx];
- }
- prevndx = ndx;
- ndx = STEPS;
- tmp = (float) (STEPS - prevndx);
- xtincr = (-xt[0]) / tmp;
- for (i = prevndx + 1; i < ndx; i++) {
- xt[i] = xt[i - 1] + xtincr;
- }
- }
-
- void initflip(int whichshelf) /* 0 = top shelf 1 = second shelf */
- {
- float tmp;
- float xtincr, ytincr, ztincr, xrincr, yrincr, zrincr;
- float yti2, zti2;
- int i;
- int ndx, prevndx;
- int count;
-
- if (whichshelf == 0) /* for the first shelf */
- yt[0] = shelftop - outsidebevel - shelfface - shelfbevel - shelfheight +.125;
- else
- yt[0] = shelftop - outsidebevel - 2.0 * shelfface - 3.0 * shelfbevel - 2.0 * shelfheight + 1.0;
- zt[0] = -87.0;
- flipdistance = sqrt(yt[0] * yt[0] + zt[0] * zt[0]);
- flipincr = flipdistance / (float) STEPS;
- xr[0] = 0.0;
- yr[0] = 0.0;
- zr[0] = 0.0;
- prevndx = 0;
- xt2[0] = 0.0;
- yt2[0] = 0.0;
- zt2[0] = 0.0;
-
- /* pull back off of the shelf */
- tmp = 7.0 / flipincr;
- ndx = (int) (tmp +.5);
- if (ndx > STEPS / 10)
- ndx = STEPS / 10;
- zt[ndx] = zt[0] + flipincr * ndx;
- xr[ndx] = xr[0];
- count = 1.0;
- for (i = 1; i <= ndx; i++) {
- yt[i] = yt[0];
- zt[i] = zt[0] + flipincr * i;
- xr[i] = xr[0];
- yr[i] = yr[0];
- zr[i] = zr[0];
- xt2[i] = 0.0;
- yt2[i] = 0.0;
- zt2[i] = 0.0;
- /* start x rotation */
- if ((zt[i] - zt[0]) > 5.0) {
- xr[i] = xr[i - 1] + count * 1.1;
- zt2[i] = zt[i] + 85.0;
- count++;
- }
- }
- /* rotate around x as it falls off of the shelf */
- prevndx = ndx;
- ndx = ndx + (2.0 * ndx / 3.0);
- zt[ndx] = zt[0] + flipincr * ndx;
- count = 1;
- xrincr = 1.1;
- for (i = prevndx + 1; i <= ndx; i++) {
- yt[i] = yt[prevndx];
- zt[i] = zt[0] + flipincr * i;
- xr[i] = xr[i - 1] + xrincr * (i - prevndx);
- yr[i] = yr[prevndx];
- zr[i] = zr[prevndx];
- if ((zt[i] - zt[0]) > 10.0) {
- zr[i] = zr[prevndx] + count * 1.1;
- count++;
- }
- xt2[i] = 0.0;
- yt2[i] = 0.0;
- zt2[i] = zt[i] + 85.0;
- }
- /* add rotate around z and start to move forward */
- prevndx = ndx;
- ndx = STEPS;
- tmp = (float) (STEPS - prevndx) - 1;
- ztincr = (10.5 - zt[prevndx]) / tmp;
- ytincr = (-yt[prevndx] + 5.125) / tmp;
- /* xtincr = (-xt[0] - 5.0) / tmp; /* book ends 5 to the left (for
- /* * when open) */
- xrincr = (155.0 - xr[prevndx]) / tmp;
- yrincr = 0.0;
- zrincr = (180.0 - zr[prevndx]) / tmp;
-
- for (i = prevndx + 1; i < ndx; i++) {
- yt[i] = yt[i - 1] + ytincr;
- zt[i] = zt[i - 1] + ztincr;
- xr[i] = xr[i - 1] + xrincr;
- if (xr[i] > 360.0)
- xr[i] = xr[i] - 360.0;
- yr[i] = yr[i - 1] + yrincr;
- zr[i] = zr[i - 1] + zrincr;
- if (zr[i] > 360.0)
- zr[i] = zr[i] - 360.0;
- xt2[i] = 0.0;
- }
- /* smooth into the new rotate origin */
- zti2 = (5.25 - zt2[prevndx]) / 19.0;
- yti2 = (5.0 - yt2[prevndx]) / 19.0;
- for (i = 1; i < 20; i++) {
- yt2[i + prevndx] = yt2[i + prevndx - 1] + yti2;
- zt2[i + prevndx] = zt2[i + prevndx - 1] + zti2;
- }
- i = i + prevndx;
- while (i < STEPS) {
- yt2[i] = yt2[i - 1];
- zt2[i] = zt2[i - 1];
- i++;
- }
- }
-
- void drawbookcase();
- void drawtitle(char *title);
-
- void flipbook()
- {
- int i;
- float time1, time2;
- float increment = 1.0;
- float dx;
- long winsize_x, winsize_y;
- int startfade;
- float color_incr;
-
- if (numberofgroups > endfirstshelf) {
- if (currentbook < endfirstshelf)
- initflip(0);
- else
- initflip(1);
- }
- startfade = 0;
- mkdoublebuffer();
- if (getgdesc(GD_BITS_NORM_ZBUFFER) > 0) {
- /* /* calculate time for 5 frames */
- /* clock_sec(&time1);
- /* for (i = 0; i < 5; i++) {
- /* drawbookcase();
- /* zbuffer(TRUE);
- /* zclear();
- /* pushmatrix();
- /* translate(xt[i], yt[i], zt[i]);
- /*
- /* rot(xr[i], 'x');
- /* rot(yr[i], 'y');
- /* rot(zr[i], 'z');
- /*
- /* setcovercolor(curgroup);
- /* pushmatrix();
- /* translate(0.0, 0.0, 5.125);
- /* rot(180.0, 'y');
- /* translate(0.0, 0.0, -5.125);
- /* drawopenframe(13);
- /* drawtitle(curgroup->nameptr->string);
- /* zbuffer(FALSE);
- /*
- /*
- /* popmatrix();
- /* popmatrix();
- /* drawpdmenu(winsize_x, winsize_y);
- /* dobookview();
- /* }
- /* clock_sec(&time2);
- /*
- /* /* divide projected time for 30 frames by target time of 3.5 seconds */
- /* increment = ((time2 - time1) * 6) / 3.0;
- /* if (increment < 1.0)
- /* increment = 1.0;
- /* printf("expected time = %f increment=%f\n",
- /* ((time2 - time1) * 6.0), increment);
- */
- getsize(&winsize_x, &winsize_y);
- /* clock_sec(&time1); */
- color_incr = 1.0 / (float)STEPS;
- for (dx = 0.0; dx < STEPS; dx += increment) {
- i = (int) dx;
- /* printf(" %d ",i); */
- if (i >= startfade) {
- color_mult = color_mult - color_incr;
- if (color_mult < 0.0)
- color_mult = 0.0;
- }
- if (i < 4) {
- /* need zbuffer while book on top of shelf */
- zbuffer(TRUE);
- zclear();
- drawbookcase();
- } else {
- drawbookcase();
- zbuffer(TRUE);
- zclear();
- }
- pushmatrix();
- translate(xt[i], yt[i], zt[i]);
-
- rot(xr[i], 'x');
- rot(yr[i], 'y');
- rot(zr[i], 'z');
-
- setcovercolor(curgroup);
- pushmatrix();
- translate(0.0, 0.0, 5.125);
- rot(180.0, 'y');
- translate(0.0, 0.0, -5.125);
- drawopenframe(13);
- if (curgroup->ok || !Hide)
- drawtitle(curgroup->nameptr->string);
- else
- drawtitle("Not Installed");
- zbuffer(FALSE);
-
-
- popmatrix();
- popmatrix();
- swapbuffers();
- }
- /* clock_sec(&time2); */
- /* printf("\n %f seconds to finish \n",time2-time1); */
- }
- /* /* end of if there's a zbuffer */
- /* else
- /* printf("\n\n NO ZBUFFER!!! \n\n");
- */
- }
-
- int find_blank(char *str)
- {
- int i;
- int len;
- Boolean found;
-
- found = FALSE;
- i = 0;
- len = strlen(str);
- while (!found && i < len) {
- if (str[i] == ' ')
- found = TRUE;
- else
- i++;
- }
- if (!found)
- i = -1;
- return (i);
- }
-
- void drawtitle(char *title)
- {
- int len;
- char *s1, *s2;
- int i;
- /* char blank = ' '; */
-
- s1 = NULL;
- s2 = NULL;
- len = strlen(title);
- c3s(morecolors[White]);
- pushmatrix();
- rot(180.0, 'y');
- translate(1.0, 2.0, 0.1);
- rot(-90.0, 'z');
- /*
- * in stroke call, x moves the text up and down the spine of the book,
- * smaller y moves the text to the left, larger y moves the text to the
- * right.
- */
- if (len <= 12)
- stroke(-7.5, -1.3, 0.58,.09,.09, 1.0, title);
- else if (len < 19)
- stroke(-7.5, -1.3, 0.58,.06,.06, 1.0, title);
- /*
- else if (len < 17)
- stroke(-7.5, -1.3, 0.58,.07,.07, 1.0, title);
- else if (len < 20)
- stroke(-7.5, -1.3, 0.58,.06,.06, 1.0, title);
- */
- else {
- /* 19 characters can fit on the binding at this size */
- i = find_blank(&(title[15]));
- if (i == -1 || i > 5 || len > 37) {
- s1 = (char *) malloc(20);
- strncpy(s1, title, 17);
- s1[15] = '.';
- s1[16] = '.';
- s1[17] = '.';
- s1[18] = '\0';
- stroke(-7.5, -1.3, 0.58,.06,.06, 1.0, s1);
- } else {
- i = i + 15;
- s1 = (char *) malloc(i + 1);
- strncpy(s1, title, i);
- s1[i] = '\0';
- stroke(-7.5, -.9, 0.58,.057,.057, 1.0, s1);
- s2 = (char *) malloc(len - i);
- strcpy(s2, &(title[i + 1]));
- stroke(-7.5, -1.7, 0.58,.057,.057, 1.0, s2);
- }
- }
- popmatrix();
- if (s1 != NULL)
- free(s1);
- if (s2 != NULL)
- free(s2);
- }
-
- void shownewposition(int pos)
- {
- float y;
- float half;
-
- half = (bookpos[1] - bookpos[0]) / 2.0;
- dooverlayview();
- color(PUP_WHITE);
- /*
- y = shelftop - shelfface - outsidebevel - shelfbevel * 2.0 - shelfheight;
- */
- y = shelftop - shelfface - outsidebevel - shelfbevel * 2.0 - shelfheight/5.5;
- pushmatrix();
- translate(0.0, y, -87.0);
- pushmatrix();
- #ifdef DEBUG
- printf(" pos %d end %d \n", pos, endfirstshelf);
- #endif
- if (pos < endfirstshelf)
- translate(bookpos[pos]-half, 0.375, 0.0);
- else
- translate(bookpos[pos]-half, 1.0 - (shelfheight + shelfbevel + shelfface), 0.0);
- pushmatrix();
- translate(0.0, 0.0, 5.125);
- rot(180.0, 'y');
- translate(0.0, 0.0, -5.125);
- /* draw arrow */
- bgnpolygon();
- v3f(arrow[0]);
- v3f(arrow[1]);
- v3f(arrow[2]);
- endpolygon();
- bgnpolygon();
- v3f(arrow[6]);
- v3f(arrow[3]);
- v3f(arrow[4]);
- endpolygon();
- bgnpolygon();
- v3f(arrow[6]);
- v3f(arrow[5]);
- v3f(arrow[4]);
- endpolygon();
- popmatrix();
- popmatrix();
- popmatrix();
- dobookview();
-
- }
-
- void highlightbookonshelf(int thisbook)
- {
- float y;
-
- dooverlayview();
- color(PUP_WHITE);
- y = shelftop - shelfface - outsidebevel - shelfbevel * 2.0 - shelfheight;
- pushmatrix();
- translate(0.0, y, -87.0);
- pushmatrix();
- if (thisbook < endfirstshelf)
- translate(bookpos[thisbook], 0.375, 0.0);
- else
- translate(bookpos[thisbook], 1.0 - (shelfheight + shelfbevel + shelfface), 0.0);
- pushmatrix();
- translate(0.0, 0.0, 5.125);
- rot(180.0, 'y');
- translate(0.0, 0.0, -5.125);
- outlinebinding();
- popmatrix();
- popmatrix();
- popmatrix();
- dobookview();
- }
-
- void pickdrawbooks()
- {
- int i;
- float y;
-
- y = shelftop - shelfface - outsidebevel - shelfbevel * 2.0 - shelfheight;
-
- pushmatrix();
- translate(0.0, y, -87.0);
-
- for (i = 0; i < numberofgroups; i++) {
- pushmatrix();
- if (i < endfirstshelf)
- translate(bookpos[i], 0.375, 0.0);
- else
- translate(bookpos[i], 1.0 - (shelfheight + shelfbevel + shelfface), 0.0);
- loadname(i);
- pushmatrix();
- translate(0.0, 0.0, 5.125);
- rot(180.0, 'y');
- translate(0.0, 0.0, -5.125);
- drawbinding();
- popmatrix();
- popmatrix();
- }
- popmatrix();
- }
-
- void drawbooks()
- {
- int i;
- struct grptmpltstruct *curgrp;
- float y;
-
- y = shelftop - shelfface - outsidebevel - shelfbevel * 2.0 - shelfheight;
-
- initnames();
- pushmatrix();
- translate(0.0, y, -87.0);
-
- curgrp = firstgroup;
- for (i = 0; i < currentbook; i++) {
- setcovercolor(curgrp);
- pushmatrix();
- if (i < endfirstshelf)
- translate(bookpos[i], 0.375, 0.0);
- else
- translate(bookpos[i], 1.0 - (shelfheight + shelfbevel + shelfface), 0.0);
- loadname(i);
- pushmatrix();
- translate(0.0, 0.0, 5.125);
- rot(180.0, 'y');
- translate(0.0, 0.0, -5.125);
- drawbinding();
- if (curgrp->ok || !Hide)
- drawtitle(curgrp->nameptr->string);
- else
- drawtitle("Not Installed");
- popmatrix();
- popmatrix();
- curgrp = curgrp->nextgrp;
- }
- if (currentbook >= 0)
- curgrp = curgrp->nextgrp;
- for (i = currentbook + 1; i < numberofbooks; i++) {
- setcovercolor(curgrp);
- pushmatrix();
- if (i < endfirstshelf)
- translate(bookpos[i], 0.3755, 0.0);
- else
- translate(bookpos[i], 1.0 - (shelfheight + shelfbevel + shelfface), 0.0);
- loadname(i);
- pushmatrix();
- translate(0.0, 0.0, 5.125);
- rot(180.0, 'y');
- translate(0.0, 0.0, -5.125);
- drawbinding();
- if (curgrp->ok || !Hide)
- drawtitle(curgrp->nameptr->string);
- else
- drawtitle("Not Installed");
- popmatrix();
- popmatrix();
- curgrp = curgrp->nextgrp;
- }
- popmatrix();
- }
-
- void pickdrawshelves()
- {
- pickdrawbooks();
- }
-
- void drawbookcase()
- {
- float carray[3];
-
- c3s(morecolors[Black]);
- clear();
- setshelfcolor(carray);
- lighten(carray);
- c3f(carray);
- /* left bevel 0,1,2,3 */
- bgnpolygon();
- v3f(shelf[0]);
- v3f(shelf[1]);
- v3f(shelf[2]);
- v3f(shelf[3]);
- endpolygon();
- /* top bevel 3, 2, 4, 5 */
- bgnpolygon();
- v3f(shelf[3]);
- v3f(shelf[2]);
- v3f(shelf[4]);
- v3f(shelf[5]);
- endpolygon();
- /* right bevel 5, 4, 6 ,7 */
- setshelfcolor(carray);
- darken(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[5]);
- v3f(shelf[4]);
- v3f(shelf[6]);
- v3f(shelf[7]);
- endpolygon();
- /* left face 2, 1, 8, 9 */
- setshelfcolor(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[2]);
- v3f(shelf[1]);
- v3f(shelf[8]);
- v3f(shelf[9]);
- endpolygon();
- /* top face 2, 9, 10, 4 */
- bgnpolygon();
- v3f(shelf[2]);
- v3f(shelf[9]);
- v3f(shelf[10]);
- v3f(shelf[4]);
- endpolygon();
- /* right face 4, 10, 11, 6 */
- bgnpolygon();
- v3f(shelf[4]);
- v3f(shelf[10]);
- v3f(shelf[11]);
- v3f(shelf[6]);
- endpolygon();
- /* top shelf left bevel 9, 12, 13, 14 */
- setshelfcolor(carray);
- darken(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[9]);
- v3f(shelf[12]);
- v3f(shelf[13]);
- v3f(shelf[14]);
- endpolygon();
- /* top shelf top bevel 9, 14, 15, 10 */
- bgnpolygon();
- v3f(shelf[9]);
- v3f(shelf[14]);
- v3f(shelf[15]);
- v3f(shelf[10]);
- endpolygon();
- /* top shelf right bevel 10, 15, 16, 17 */
- setshelfcolor(carray);
- lighten(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[10]);
- v3f(shelf[15]);
- v3f(shelf[16]);
- v3f(shelf[17]);
- endpolygon();
- /* second shelf left bevel 18, 20, 21, 22 */
- setshelfcolor(carray);
- darken(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[18]);
- v3f(shelf[20]);
- v3f(shelf[21]);
- v3f(shelf[22]);
- endpolygon();
- /* second shelf top bevel 18, 22, 23, 19 */
- bgnpolygon();
- v3f(shelf[18]);
- v3f(shelf[22]);
- v3f(shelf[23]);
- v3f(shelf[19]);
- endpolygon();
- /* second shelf right bevel 19, 23, 24, 25 */
- setshelfcolor(carray);
- lighten(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[19]);
- v3f(shelf[23]);
- v3f(shelf[24]);
- v3f(shelf[25]);
- endpolygon();
- /* third shelf left bevel 26, 28, 29, 30 */
- setshelfcolor(carray);
- darken(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[26]);
- v3f(shelf[28]);
- v3f(shelf[29]);
- v3f(shelf[30]);
- endpolygon();
- /* third shelf top bevel 26, 30, 31, 27 */
- bgnpolygon();
- v3f(shelf[26]);
- v3f(shelf[30]);
- v3f(shelf[31]);
- v3f(shelf[27]);
- endpolygon();
- /* third shelf right bevel 27, 31, 32, 33 */
- setshelfcolor(carray);
- lighten(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[27]);
- v3f(shelf[31]);
- v3f(shelf[32]);
- v3f(shelf[33]);
- endpolygon();
-
- drawbooks();
-
- setshelfcolor(carray);
- lighten(carray);
- c3f(carray);
- /* top shelf bottom bevel 12, 17, 16, 13 */
- bgnpolygon();
- v3f(shelf[12]);
- v3f(shelf[17]);
- v3f(shelf[16]);
- v3f(shelf[13]);
- endpolygon();
- /* face between top two shelves 12, 18, 19, 17 */
- setshelfcolor(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[12]);
- v3f(shelf[18]);
- v3f(shelf[19]);
- v3f(shelf[17]);
- endpolygon();
-
- setshelfcolor(carray);
- lighten(carray);
- c3f(carray);
- /* second shelf bottom bevel 20, 25, 24, 21 */
- bgnpolygon();
- v3f(shelf[20]);
- v3f(shelf[25]);
- v3f(shelf[24]);
- v3f(shelf[21]);
- endpolygon();
- /* second shelf face between second and third shelves 20, 26, 27, 25 */
- setshelfcolor(carray);
- c3f(carray);
- bgnpolygon();
- v3f(shelf[20]);
- v3f(shelf[26]);
- v3f(shelf[27]);
- v3f(shelf[25]);
- endpolygon();
- }
-
- void initbookpos()
- {
- int i;
- float x;
- float center;
- float booksep;
- float start, start2;
- float end;
- int half;
-
- start2 = 0;
- numberofbooks = numberofgroups;
- booksep = 2.25;
- center = 0.0;
- if (numberofbooks > 21)
- {
- half = numberofbooks/2;
- end = (2.25 * half) / 2.0 - 1;
- endfirstshelf = half;
- if (half /2*2 == half)
- start = center - (half / 2) * booksep;
- else
- start = center - ((float)half / 2.0) * booksep;
- half = numberofbooks-half;
- if (half /2*2 == half)
- start2 = center - (half / 2) * booksep;
- else
- start2 = center - ((float)half / 2.0) * booksep;
- }
- else
- {
- end = shelfright;
- endfirstshelf = numberofbooks;
- if (numberofbooks / 2 * 2 == numberofbooks)
- {
- start = center - (numberofbooks / 2) * booksep;
- }
- else
- {
- start = center - ((float)numberofbooks / 2.0) * booksep;
- }
- }
- x = start;
- for (i = 0; i < numberofbooks; i++)
- {
- if (x > end)
- x = start2;
- bookpos[i] = x;
- x+=booksep;
- }
- currentbook = -1;
- }
-
- initshelves()
- {
- initflip(0);
- /* left bevel 0,1,2,3*/
- shelf[0][0] = shelfleft;
- shelf[0][1] = shelfbottom;
- shelf[0][2] = shelffront;
- shelf[1][0] = shelfleft+outsidebevel;
- shelf[1][1] = shelfbottom;
- shelf[1][2] = shelffront;
- shelf[2][0] = shelfleft+outsidebevel;
- shelf[2][1] = shelftop-outsidebevel;
- shelf[2][2] = shelffront;
- shelf[3][0] = shelfleft;
- shelf[3][1] = shelftop;
- shelf[3][2] = shelffront;
- /* top bevel 3, 2, 4, 5*/
- shelf[4][0] = shelfright-outsidebevel;
- shelf[4][1] = shelftop-outsidebevel;
- shelf[4][2] = shelffront;
- shelf[5][0] = shelfright;
- shelf[5][1] = shelftop;
- shelf[5][2] = shelffront;
- /* right bevel 5, 4, 6 ,7 */
- shelf[6][0] = shelfright-outsidebevel;
- shelf[6][1] = shelfbottom;
- shelf[6][2] = shelffront;
- shelf[7][0] = shelfright;
- shelf[7][1] = shelfbottom;
- shelf[7][2] = shelffront;
- /* left face 2, 1, 8, 9 */
- shelf[8][0] = shelfleft+outsidebevel + shelfface;
- shelf[8][1] = shelfbottom;
- shelf[8][2] = shelffront;
- shelf[9][0] = shelfleft + outsidebevel + shelfface;
- shelf[9][1] = shelftop - outsidebevel - shelfface;
- shelf[9][2] = shelffront;
- /* top face 2, 9, 10, 4 */
- shelf[10][0] = shelfright - outsidebevel - shelfface;
- shelf[10][1] = shelftop - outsidebevel - shelfface;
- shelf[10][2] = shelffront;
- /* right face 4, 10, 11, 6 */
- shelf[11][0] = shelfright- outsidebevel - shelfface;
- shelf[11][1] = shelfbottom;
- shelf[11][2] = shelffront;
- /* inset for top shelf */
- /* top shelf left bevel 9, 12, 13, 14 */
- shelf[12][0] = shelfleft + outsidebevel + shelfface;
- shelf[12][1] = shelftop-outsidebevel-shelfface-shelfheight- (shelfbevel*2.0);
- shelf[12][2] = shelffront;
- shelf[13][0] = shelf[12][0] + shelfbevel;
- shelf[13][1] = shelf[12][1] + shelfbevel;
- shelf[13][2] = shelffront;
- shelf[14][0] = shelf[9][0] + shelfbevel;
- shelf[14][1] = shelf[9][1] - shelfbevel;
- shelf[14][2] = shelffront;
- /* top shelf top bevel 9, 14, 15, 10 */
- shelf[15][0] = shelf[10][0] - shelfbevel;
- shelf[15][1] = shelf[14][1];
- shelf[15][2] = shelffront;
- /* top shelf right bevel 10, 15, 16, 17 */
- shelf[16][0] = shelf[15][0];
- shelf[16][1] = shelf[13][1];
- shelf[16][2] = shelffront;
- shelf[17][0] = shelf[10][0];
- shelf[17][1] = shelf[12][1];
- shelf[17][2] = shelffront;
- /* top shelf bottom bevel 12, 17, 16, 13 */
- /* face between top two shelves 12, 18, 19, 17 */
- shelf[18][0] = shelf[12][0];
- shelf[18][1] = shelf[12][1] - shelfface;
- shelf[18][2] = shelffront;
- shelf[19][0] = shelf[17][0];
- shelf[19][1] = shelf[17][1] - shelfface;
- shelf[19][2] = shelffront;
- /* second shelf */
- /* second shelf left bevel 18, 20, 21, 22 */
- shelf[20][0] = shelf[12][0];
- shelf[20][1] = shelf[18][1] - shelfbevel*2.0 - shelfheight;
- shelf[20][2] = shelffront;
- shelf[21][0] = shelf[20][0] + shelfbevel;
- shelf[21][1] = shelf[20][1] + shelfbevel;
- shelf[21][2] = shelffront;
- shelf[22][0] = shelf[18][0] + shelfbevel;
- shelf[22][1] = shelf[18][1] - shelfbevel;
- shelf[22][2] = shelffront;
- /* second shelf top bevel 18, 22, 23, 19 */
- shelf[23][0] = shelf[19][0] - shelfbevel;
- shelf[23][1] = shelf[19][1] - shelfbevel;
- shelf[23][2] = shelffront;
- /* second shelf right bevel 19, 23, 24, 25 */
- shelf[24][0] = shelf[23][0];
- shelf[24][1] = shelf[21][1];
- shelf[24][2] = shelffront;
- shelf[25][0] = shelf[19][0];
- shelf[25][1] = shelf[20][1];
- shelf[25][2] = shelffront;
- /* second shelf bottom bevel 20, 25, 24, 21 */
- /* second shelf face between second and third shelves 20, 26, 27, 25 */
- shelf[26][0] = shelf[20][0];
- shelf[26][1] = shelf[20][1] - shelfface;
- shelf[26][2] = shelffront;
- shelf[27][0] = shelf[25][0];
- shelf[27][1] = shelf[26][1];
- shelf[27][2] = shelffront;
- /* third shelf left bevel 26, 28, 29, 30 */
- shelf[28][0] = shelf[26][0];
- shelf[28][1] = shelf[26][0] - shelfbevel*2.0 - shelfheight;
- shelf[28][2] = shelffront;
- shelf[29][0] = shelf[28][0] + shelfbevel;
- shelf[29][1] = shelf[28][1] + shelfbevel;
- shelf[29][2] = shelffront;
- shelf[30][0] = shelf[26][0] + shelfbevel;
- shelf[30][1] = shelf[26][1] - shelfbevel;
- shelf[30][2] = shelffront;
- /* third shelf top bevel 26, 30, 31, 27 */
- shelf[31][0] = shelf[27][0] - shelfbevel;
- shelf[31][1] = shelf[30][1];
- shelf[31][2] = shelffront;
- /* third shelf right bevel 27, 31, 32, 33 */
- shelf[32][0] = shelf[31][0];
- shelf[32][1] = shelf[29][1];
- shelf[32][2] = shelffront;
- shelf[33][0] = shelf[32][0] + shelfbevel;
- shelf[33][1] = shelf[28][1];
- shelf[33][2] = shelffront;
- /* third shelf bottombevel 29, 28, 33, 32 */
-
- }
-
-